// custom-tab-bar/index.ts
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    select: 0,
    list: [
      {
        iconPath: "/images/index.png",
        pagePath: "/pages/index/index",
        selectedIconPath: "/images/indexselect.png",
        text: "首页",
        type: 0
      },
      {
        iconPath: "/images/selfstudy.png",
        pagePath: "/pages/selfstudy/index",
        selectedIconPath: "/images/selfstudyselect.png",
        text: "自习",
        type: 0
      },
      // {
      //   type: 1,
      // },
      {
        iconPath: "/images/communication.png",
        pagePath: "/pages/communication/index",
        selectedIconPath: "/images/communicationselect.png",
        text: "交流",
        type: 0,
      },
      {
        iconPath: "/images/my.png",
        pagePath: "/pages/my/index",
        selectedIconPath: "/images/myselect.png",
        text: "我的",
        type: 0
      }
    ]
  },
  /**
   * 组件的方法列表
   */
  methods: {
    selectPage(e: any) {

      const {index, page, type } = e.currentTarget.dataset;


      console.log("跳转->", page)
      if (index !== this.data.select && type === 0) {
        wx.switchTab({
          url: page
        })

      }
    }
  }
})
